// 工具方法

export function DateFormateDHMS(timer) {
  timer = Number(timer);
  if (timer && !isNaN(timer)) {
    var date = new Date(timer);
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    var hour = date.getHours();
    var min = date.getMinutes();
    var sec = date.getSeconds();
    [year, month, day, hour, min, sec] = [year, month, day, hour, min, sec].map(
      (item) => (item < 10 ? "0" + item : item)
    );
    return `${year}-${month}-${day} ${hour}:${min}:${sec}`;
  } else {
    return "--";
  }
}
